/*
 ID: brodyzt1
 PROG: calfflac
 LANG: C++
 */

#include <iostream>
#include <fstream>
#include <sstream>

using namespace std;

string stringSection (string origString, int index1, int index2)
{
    stringstream tempstream;
    for (int i = index1; i < index2 - index1 + 1; i++) {
        tempstream << origString[i];
    }
    string tempString;
    tempstream >> tempString;
    return tempString;
}

bool charNotPunct (char origChar)
{
    return origChar != ' ' && origChar != ':' && origChar != ',' && origChar != '.' && origChar != '_' && origChar != '\'';
}

int absoluteVal (int num1, int num2)
{
    if(num1 > num2)
    {
        return num1 - num2;
    } else {
        return num2 - num1;
    }
}

string stringWithoutPunct (string origString)
{
    stringstream tempStream;
    for (int i = 0; i < origString.length() ; i++) {
        if (charNotPunct(origString[i])) {
            tempStream << origString[i];
        }
    }
    string tempString;
    tempStream >> tempString;
    return tempString;
}

bool areLettersEqual (char char1, char char2)
{
    return char1 == char2 || absoluteVal((int)char1, (int) char2) == 32;
}

int palindromeLength (string origString, double index)
{
    double i = 0;
    double extraLeft = 0, extraRight = 0;
    if (areLettersEqual(origString[index], origString[index - 1]) &&  !areLettersEqual(origString[index], origString[index + 1])) {
        extraLeft ++;
    }
    else if(!areLettersEqual(origString[index], origString[index - 1]) &&  areLettersEqual(origString[index], origString[index + 1]))
    {
        extraRight ++;
    }
    while (areLettersEqual(origString[index + i + extraRight], origString[(index - i) - extraLeft]) & (index + i + extraRight != origString.length() || (index - i) - extraLeft > 0)) {
        i++;
    }
    return (2 * i) - 1 + extraRight + extraLeft;
}

double maxPalindromeLength (string origString)
{
    double max = 0;
    origString = stringWithoutPunct(origString);
    for (int i = 0; i < origString.length(); i ++) {
        double tempDouble = palindromeLength(origString, i);
        if(tempDouble > max)
        {
            max = tempDouble;
        }
    }
    return max;
}

double maxPalindromeIndex (string origString)
{
    double maxIndex = 0;
    double max = 0;
    origString = stringWithoutPunct(origString);
    for (int i = 0; i < origString.length(); i ++) {
        double tempDouble = palindromeLength(origString, i);
        if(tempDouble > max)
        {
            maxIndex = i;
            max = tempDouble;
        }
    }
    return maxIndex;
}

string palindromeAtIndex (string origString, int index)
{
    int i = 3;
    int leftIndex = index - 1, rightIndex = index + 1;
    while (!charNotPunct(origString[leftIndex])) {
        leftIndex --;
        i ++;
    }
    while (!charNotPunct(origString[rightIndex])) {
        rightIndex ++;
        i++;
    }
    while (areLettersEqual(origString[leftIndex], origString[rightIndex])) {
        leftIndex --;
        rightIndex ++;
        i +=2;
        while (!charNotPunct(origString[leftIndex])) {
            leftIndex --;
            i ++;
        }
        while (!charNotPunct(origString[rightIndex])) {
            rightIndex ++;
            i++;
        }
    }
    return stringSection(origString, leftIndex + 1, rightIndex - 1);
}

int main(int argc, const char * argv[])
{
    ifstream input("calfflac.in");
    string origString;
    getline(input, origString);
    
    ofstream output("calfflac.out");
    output << maxPalindromeLength(origString) << "\n";
    output << palindromeAtIndex(origString, maxPalindromeIndex(origString)) << "\n";
   
    return 0;
}

